/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.oneCommerce.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Aymen
 */
@Entity
@Table(name = "FOURNISSEUR", catalog = "", schema = "AYMEN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Fournisseur.findAll", query = "SELECT f FROM Fournisseur f"),
    @NamedQuery(name = "Fournisseur.findByIdfour", query = "SELECT f FROM Fournisseur f WHERE f.idfour = :idfour"),
    @NamedQuery(name = "Fournisseur.findByTelfour", query = "SELECT f FROM Fournisseur f WHERE f.telfour = :telfour"),
    @NamedQuery(name = "Fournisseur.findBySiteweb", query = "SELECT f FROM Fournisseur f WHERE f.siteweb = :siteweb"),
    @NamedQuery(name = "Fournisseur.findByNomfour", query = "SELECT f FROM Fournisseur f WHERE f.nomfour = :nomfour"),
    @NamedQuery(name = "Fournisseur.findByAdressefour", query = "SELECT f FROM Fournisseur f WHERE f.adressefour = :adressefour")})
public class Fournisseur implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDFOUR", nullable = false, precision = 22, scale = 0)
    @GeneratedValue(strategy= GenerationType.AUTO)
    private BigDecimal idfour;
    @Basic(optional = false)
    @NotNull
    @Column(name = "TELFOUR", nullable = false)
    private BigInteger telfour;
    @Size(max = 50)
    @Column(name = "SITEWEB", length = 50)
    private String siteweb;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "NOMFOUR", nullable = false, length = 50)
    private String nomfour;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "ADRESSEFOUR", nullable = false, length = 50)
    private String adressefour;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idfour")
    private Collection<Commandefour> commandefourCollection;

    public Fournisseur() {
    }

    public Fournisseur(BigDecimal idfour) {
        this.idfour = idfour;
    }

    public Fournisseur(BigDecimal idfour, BigInteger telfour, String nomfour, String adressefour) {
        this.idfour = idfour;
        this.telfour = telfour;
        this.nomfour = nomfour;
        this.adressefour = adressefour;
    }

    public BigDecimal getIdfour() {
        return idfour;
    }

    public void setIdfour(BigDecimal idfour) {
        this.idfour = idfour;
    }

    public BigInteger getTelfour() {
        return telfour;
    }

    public void setTelfour(BigInteger telfour) {
        this.telfour = telfour;
    }

    public String getSiteweb() {
        return siteweb;
    }

    public void setSiteweb(String siteweb) {
        this.siteweb = siteweb;
    }

    public String getNomfour() {
        return nomfour;
    }

    public void setNomfour(String nomfour) {
        this.nomfour = nomfour;
    }

    public String getAdressefour() {
        return adressefour;
    }

    public void setAdressefour(String adressefour) {
        this.adressefour = adressefour;
    }

    @XmlTransient
    public Collection<Commandefour> getCommandefourCollection() {
        return commandefourCollection;
    }

    public void setCommandefourCollection(Collection<Commandefour> commandefourCollection) {
        this.commandefourCollection = commandefourCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idfour != null ? idfour.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fournisseur)) {
            return false;
        }
        Fournisseur other = (Fournisseur) object;
        if ((this.idfour == null && other.idfour != null) || (this.idfour != null && !this.idfour.equals(other.idfour))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.oneCommerce.entities.Fournisseur[ idfour=" + idfour + " ]";
    }
    
}
